
from PySide6.QtWidgets import QApplication, QWidget, QVBoxLayout, QLineEdit, QSizePolicy
import sys

from keyboard import Keyboard, NumberKeyboard

# 定义样式表
qss = """
QLineEdit {
    border-style: none;
    padding: 3px;
    border-radius: 5px;
    border: 1px solid #dce5ec;
    font-size: 30px;
}
"""

def main():
    app = QApplication(sys.argv)

    # 可选字体设置
    # ENABLED_WQY_FONT = True  # 根据需要设置
    # if ENABLED_WQY_FONT:
    #     font_id = QFontDatabase.addApplicationFont("./assets/Font/wqy-microhei.ttc")
    #     font_families = QFontDatabase.applicationFontFamilies(font_id)
    #     app.setFont(font_families[0])

    # 主窗口1
    window = QWidget()
    window.setWindowTitle("QtKeyboard by jzShen")
    window.setStyleSheet("background-color: #111111")
    window.resize(850, 370)
    keyboard = Keyboard()

    text_input = QLineEdit()
    text_input.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
    text_input.setStyleSheet(qss)

    v_layout = QVBoxLayout()
    v_layout.addWidget(text_input, 1)
    v_layout.addWidget(keyboard, 5)

    window.setLayout(v_layout)
    window.show()

    # 主窗口2
    window2 = QWidget()
    window2.setWindowTitle("数字键盘 by jzShen")
    window2.setStyleSheet("background-color: #111111")
    window2.resize(450, 370)

    keyboard2 = NumberKeyboard()
    keyboard2.show()

    text_input2 = QLineEdit()
    text_input2.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
    text_input2.setStyleSheet(qss)

    v_layout2 = QVBoxLayout()
    v_layout2.addWidget(text_input2, 1)
    v_layout2.addWidget(keyboard2, 5)

    window2.setLayout(v_layout2)
    window2.show()

    sys.exit(app.exec())

if __name__ == '__main__':
    main()
